package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.ExtIotViceCalculation;
import com.econ.powercloud.ems.dal.entity.ext.SceneCalculation;
import com.econ.powercloud.ems.dal.mapper.ExtIotViceCalculationMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ Description:
 * @ Author：hgp
 * @ Create:2022-05-23-17:02
 */
@Repository
public class ExtIotViceCalculationDAO extends ServiceImpl<ExtIotViceCalculationMapper, ExtIotViceCalculation> {

    public List<SceneCalculation> selectSceneCalculationListBySceneCode(String sceneCode) {
        return this.baseMapper.selectSceneCalculationListBySceneCode(sceneCode);
    }

    public List<ExtIotViceCalculation> getListByVal2TagList(List<String> tagList){
        LambdaQueryWrapper<ExtIotViceCalculation> wrapper = Wrappers.lambdaQuery();
        if (CollectionUtils.isNotEmpty(tagList)){
            wrapper.in(ExtIotViceCalculation::getVal2,tagList);
        }
        return this.baseMapper.selectList(wrapper);
    }

}
